package winOrDie.graphics.maps;

import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;

/**
 * This public final class defines colors for different map cell types
 *
 */
public final class Map_Colors 
{
	public static RGB rgb_Corridor = new RGB(179, 204, 179);
	public static RGB rgb_Wall = new RGB(0, 51, 102);
	public static RGB rgb_Pirates_Room = new RGB(219, 219, 0);
	public static RGB rgb_Tower = new RGB(87, 255, 255);
	public static RGB rgb_Tower_Door = new RGB(194, 71, 71);
	public static RGB rgb_Exit = new RGB(71, 117, 255);

	
	/**
	 * This public static method returns {@link Color} object from {@link RGB}
	 * @param rgb
	 * @param display 
	 * @return {@link Color}
	 */
	public static Color getColorFromRGB(RGB rgb, Display display)
	{
		return new Color(display, rgb);
	}
	
	/**
	 * This public static method returns {@link Image} object from {@link RGB}
	 * @param rgb
	 * @param width
	 * @param height
	 * @param display
	 * @return {@link Image}
	 * @throws Exception
	 */
	public static Image get_ImageFromRGB(RGB rgb, int width, int height, Display display) throws Exception
	{
		Image image = new Image(display, width, height);
		GC gc = new GC(image);
		gc.setBackground(getColorFromRGB(rgb, display));
	    gc.drawRectangle(0, 0, width, height);
	    gc.dispose();
	    return image;
	}
	
	
}
